package com.itheima.reggie.common;

// 基于ThreadLocal封装工具类，用户保存和获取当前登录用户id
public class UserIdHolder {
    // 整个程序中 只有这一个 ThreadLocal对象
    private static final ThreadLocal<Long> Thread_Local = new ThreadLocal<>();

    public static void set(Long UserId) {
        Thread_Local.set(UserId);
    }

    public static Long get() {
        return Thread_Local.get();
    }

    public static void remove() {
        Thread_Local.remove();
    }

}
